package main

import (
	"booking/common/logger"
	"booking/config"
	"booking/internal/console/test"
	"booking/locales"
	"booking/models"
	"os"
	"time"
)

type commandFunc func([]string)

var commands = map[string]commandFunc{
	"test": test.Test,
}

func main() {
	time.Local = time.UTC
	config.Init()
	models.Database()
	models.Redis()
	locales.Init()
	// 初始化事件系统
	if len(os.Args) < 2 {
		logger.Fatalf("usage: %s <command> [args...]", os.Args[0])
	}

	cmdName := os.Args[1]
	run, exists := commands[cmdName]
	if !exists {
		logger.Fatalf("unknown command: %s", cmdName)
	}

	run(os.Args[2:])
}
